<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a="https://ajax4jsf.dev.java.net/ajax"
	  			xmlns:s="http://jboss.com/products/seam/taglib"
				template="template.xhtml">

<!-- content -->
<ui:define name="content">

<div class="section">

<h:form id="timesheetEntryForm">
	Project: &#160;
	
	<h:selectOneMenu value="#{timesheetEntry.projectId}" required="true">
		<s:selectItems value="#{projectSelections}" var="project" label="#{project.name}" noSelectionLabel="Make Selection" itemValue="#{project.id}" />
	</h:selectOneMenu>
   	
    	<br/><br/>
    	
    Please enter your time:
    <table border="1">
    	
    	<ui:repeat value="#{newTimesheet.entries}" var="entry">
    		<tr>
    		  <td>
    		  	<h:outputText value="#{entry.date}">
    		  		<f:convertDateTime pattern="MM/dd" />
    		  	</h:outputText>
    		  </td>
    		  <td>
    		  	<h:inputText value="#{entry.hours}" size="2">
    		  		<a:support event="onkeyup" reRender="totalHoursWorked" />
    		  	</h:inputText>
    		  </td>
    		</tr>
    	</ui:repeat>
    </table>
    
    Total hours worked: &#160; <h:outputText id="totalHoursWorked" value="#{newTimesheet.totalHoursWorked}" />
    	<br/><br/>
    <h:commandButton action="#{timesheetEntry.save}" value="Save" />
    	&#160;
    <h:commandButton action="#{timesheetEntry.submit}" value="Submit" />
    	&#160;
    <h:commandButton action="#{timesheetEntry.cancel}" value="Cancel" />
</h:form>

</div>

</ui:define>

</ui:composition>
